import React from 'react'

// 类组件
class eventComponent extends React.Component {
    handleClick(e) {
        console.log('点击了按钮')
        console.log(e)
    }
    HandleToLink(e) {
        e.preventDefault()
        console.log(e)
        window.open('https://www.douyin.com/')
    }

    render() {
        return (
            <div>
                <button onClick={this.handleClick}> 按钮 </button>
                <a href="www.baidu.com" onClick={this.HandleToLink}>
                    to Tiktok
                </a>
            </div>
        )
    }
}

// 函数组件
// function eventComponent() {
//     function handleClick() {
//         console.log('点击了按钮')
//     }
//     return (
//         <div>
//             <button onClick={handleClick}> 按钮 </button>
//         </div>
//     )
// }

export default eventComponent
